Skip to content

feat(results): add audit metadata to results endpoint - #56

Open
pgreat123 wants to merge 1 commit into
AnonVote:mainfrom
pgreat123:feat/results-metadata-audit
Open

feat(results): add audit metadata to results endpoint#56
pgreat123 wants to merge 1 commit into
AnonVote:mainfrom
pgreat123:feat/results-metadata-audit

Conversation

@pgreat123

Copy link
Copy Markdown

Closes #38

Summary

Adds an audit-friendly metadata object to the GET /api/results/:ballotId response, alongside a simple resultsByLabel map ({ "Option A": 45 }) matching the issue's example. Frontend now displays this metadata on the public results page.

Changes

  • backend/src/routes/results.ts — added metadata object (ballot_id, ballot_title, total_votes, tally_timestamp, stellar_transaction_id, is_consistent, encryption_note) and resultsByLabel
  • backend/src/tests/results.test.ts — coverage for metadata fields and accuracy
  • frontend/src/pages/ResultsPage.tsx — displays metadata, consistency badge, collapsible encryption note, Stellar transaction link
  • frontend/src/types/index.ts — updated types for the new response shape

Note for reviewers

While rebasing onto the latest main, I found that backend/src/services/emailService.ts and backend/src/routes/votes.ts currently fail to compile with tsc (missing closing brace before the sendVoterTokenEmail doc comment, and a mismatched try/catch block). This is unrelated to this PR — confirmed present directly on main via git show app-upstream/main:... before any of my changes. It will block builds/CI for this and other open PRs until fixed. Flagging here rather than bundling an unrelated fix into this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API returns raw vote counts in results endpoint — add confidence intervals and audit note

1 participant